package kr.hyunist.androidcomplete02saeildamil;

import kr.hyunist.androidcomplete02saeildamil.ch20.Ch20Activity;
import kr.hyunist.androidcomplete02saeildamil.ch23.Ch23Activity;
import kr.hyunist.androidcomplete02saeildamil.ch25.Ch25Activity;
import kr.hyunist.androidcomplete02saeildamil.ch26.Ch26Activity;
import kr.hyunist.androidcomplete02saeildamil.ch27.Ch27Activity;
import kr.hyunist.androidcomplete02saeildamil.ch30.Ch30Activity;
import kr.hyunist.androidcomplete02saeildamil.ch33.Ch33Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends ListActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
				this, R.array.chapter, android.R.layout.simple_list_item_1);
		setListAdapter(adapter);

	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		Intent intent = null;

		switch (position) {
		case 0:
			intent = new Intent(this, Ch20Activity.class);
			break;
		case 1:
			intent = new Intent(this, Ch23Activity.class);
			break;
		case 2:
			intent = new Intent(this, Ch25Activity.class);
			break;
		case 3:
			intent = new Intent(this, Ch26Activity.class);
			break;
		case 4:
			intent = new Intent(this, Ch27Activity.class);
			break;
		case 5:
			intent = new Intent(this, Ch30Activity.class);
			break;
		case 6:
			intent = new Intent(this, Ch33Activity.class);
			break;
		}

		startActivity(intent);
	}

}
